package jasonllinux.app.control3;


import java.util.ArrayList;
import java.util.HashMap;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;

//ListView

public class Activity01 extends ListActivity {
    /** Called when the activity is first created. */
	
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>();
    	HashMap<String, String> map1 = new HashMap<String, String>();
    	HashMap<String, String> map2 = new HashMap<String, String>();
    	HashMap<String, String> map3 = new HashMap<String, String>();
    	map1.put("name", "LiHua");
    	map1.put("ip", "10.20.154.12");
    	map2.put("name", "XiaoLi");
    	map2.put("ip", "10.20.154.13");
    	map3.put("name", "Daier");
    	map3.put("ip", "10.20.154.14");
    	list.add(map1);
    	list.add(map2);
    	list.add(map3);
    	SimpleAdapter listAdapter = new SimpleAdapter(this, list, R.layout.listview, new String[] {"name","ip"}, new int[] {R.id.name, R.id.ip});
    	setListAdapter(listAdapter);
    
    	
    }

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		
		super.onListItemClick(l, v, position, id);
		System.out.println("hello");
	}
    
    
}